package com.lml.yunpicturesbackend.exception;

/**
 * 异常处理工具类
 * @date 2025/1/25 18:06
 */
public class ThrowUtils {
    public static void throwIf(boolean condition, RuntimeException runtimeException){
        if(condition){
            throw runtimeException;
        }
    }

    /**
     * @description:
     * @Param:
     * @param condition 条件
     * @param errorCode 错误码
     * @return:
     * @time: 2025/4/3 21:56
     **/
    public static void throwIf(boolean condition, ErrorCode errorCode){
        throwIf(condition,new BusinessException(errorCode));
    }

    /**
     * @description: //TODO
     * @Param:
     * @param condition 条件
     * @param errorCode 错误码
     * @param message 信息
     * @return:
     * @time: 2025/4/3 21:58
     */
    public static void throwIf(boolean condition, ErrorCode errorCode,String message){
        throwIf(condition,new BusinessException(errorCode,message));
    }
}
